<script>
import { edit } from '@/mixins/system'
export default {
  name: 'Email',
  mixins: [edit],
  data() {
    return {
      options: [
        { value: 'POP3', label: 'POP3' },
        { value: 'SMTP', label: 'SMTP' },
        { value: 'IMAP', label: 'IMAP' }
      ]
    }
  }
}
</script>

<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="close"
    :visible.sync="show"
    title="邮件通道"
    width="700px"
  >
    <div v-loading="loading" class="custom-dialog-body">
      <el-form
        v-if="form.id && loading === false"
        ref="form"
        :inline="true"
        :model="set"
        size="small"
        label-width="150px"
      >
        <el-form-item
          :rules="[{ required: true, message: '请选择发送协议', trigger: 'blur' }]"
          label="发送协议"
          prop="protocol"
        >
          <el-select v-model="set.protocol" placeholder="请选择发送协议" style="width: 400px;">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            /></el-select>
        </el-form-item>
        <el-form-item
          :rules="[{ required: true, message: '请输入服务地址', trigger: 'blur' }]"
          label="服务地址"
          prop="host"
        >
          <el-input v-model="set.host" placeholder="请输入服务地址" style="width: 400px;" />
        </el-form-item>
        <el-form-item
          label="端口号"
          prop="port"
        >
          <el-input v-model="set.port" placeholder="请输入端口号" style="width: 400px;" />
        </el-form-item>
        <el-form-item
          :rules="[{ required: true, message: '请输入发送账号', trigger: 'blur' }]"
          label="发送账号"
          prop="username"
        >
          <el-input v-model="set.username" placeholder="请输入发送账号" style="width: 400px;" />
        </el-form-item>
        <el-form-item
          :rules="[{ required: true, message: '请输入参数列表', trigger: 'blur' }]"
          label="账号密码"
          prop="password"
        >
          <el-input v-model="set.password" placeholder="请输入参数列表" style="width: 400px;" />
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="close">取消</el-button>
      <el-button
        :loading="saveObj"
        type="primary"
        @click="submitCU"
      >保存</el-button>
    </div>
  </el-dialog>
</template>

<style scoped>

</style>
